<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:fhj="http://java.sun.com/jsf/composite/fhj"
	template="/resources/templates/template.xhtml">
	<ui:param name="pageTitle" value="News" />
	<ui:define name="content">
		<h:form id="newsoverview">
			<h2>News Overview:</h2>
			<p:dataTable id="newslist" value="#{newsBean.newsList}" var="news">
				<p:column headerText="Date/Time">
					<h:outputText value="#{news.timestamp}">
						<f:convertDateTime pattern="yyyy-MM-dd HH:mm" />
					</h:outputText>
				</p:column>
				<p:column headerText="Title">
					<h:outputText value="#{news.title}" />
				</p:column>
				<p:column headerText="Creator">
					<h:outputText value="#{news.creator.username}" />
				</p:column>
				<p:column>
					<p:commandButton value="Edit" action="news_edit">
						<f:setPropertyActionListener target="#{newsBean.selectedNews}" value="#{news}" />
					</p:commandButton>
					
				</p:column>
			</p:dataTable>
			<p:button id="createnews" value="Create News" outcome="news_create" />
		</h:form>
	</ui:define>
</ui:composition>